package com.fagu.openerp;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class MyProperties {

	private static Logger log = Logger.getLogger(MyProperties.class);
	
	public MyProperties() {
		PropertyConfigurator.configure(getClass().getResourceAsStream("log4j.properties"));
	}
	
	public static Properties getProperties(String args) {
		Properties props = new Properties();
		try {
			InputStream inputStream = MyProperties.class.getResourceAsStream(args);
			
			if (inputStream == null) {
				log.error("File not found!");
				return null;
			}
		
			props.load(inputStream);
		} catch (IOException e1) {
			e1.getMessage();
			e1.printStackTrace();
		} 
		
		return props;
	}
}
